package com.lrs.java.dataStructure.linkList;

class LinkQueue {
	private FirstLastList list;

	public LinkQueue() {
		list = new FirstLastList();
	}

	public boolean isEmpty() {
		return list.isEmpty();
	}

	public void insert(int j) {
		list.insertLast(j, j+0.0);
	}

	public long remove() {
		return list.removeFirst().getiData();
	}

	public void displayQueue() {
		System.out.print("Queue (front-->rear): ");
		list.display();
	}
}

class LinkQueueApp {

	public static void main(String[] args) {
		LinkQueue theQueue = new LinkQueue();
		theQueue.insert(20); // insert items
		theQueue.insert(40);

		theQueue.displayQueue(); // display queue

		theQueue.insert(60); // insert items
		theQueue.insert(80);

		theQueue.displayQueue(); // display queue

		theQueue.remove(); // remove items
		theQueue.remove();

		theQueue.displayQueue(); // display queue
	}
}
